import flask

from flask import Flask,render_template,redirect,url_for, \
                    request,session,g

from robot.QPorigin import QuestionPrediction

app = Flask(__name__)
q = QuestionPrediction()

# 注册页面
@app.route('/query', methods=['GET', 'POST'])
def query():
    if request.method == 'GET':
        return render_template('query.html')
    else:
        query_ = request.form['query']
        ans = q.predict(query_)
        return render_template("query.html",ans=ans)




if __name__ == '__main__':

    # collenction_statistic.update({'n_user':{'$gte':0}}, {'n_user':0})

    # db_redis.sadd('thing','init','init')
    # g.nothing = 'nothing'
    app.run()

    # print(collection_user.find())


    # app.run(host="0.0.0.0")
    # 默认地址是127.0.0.1, 可以设置
    # 默认端口是5000, 可以设置
    # app.run(host='0.0.0.0',port=5050)  #0.0.0.0和127.0.0.1好像是一样的

